﻿namespace 测试虚方法
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello, World!");

            B b = new B();
            b.Foo();
        }
    }


    class A
    {
        public virtual void Foo()
        {
            return;
            Console.WriteLine("A.Foo()");
           
        }
    }

    class B : A
    {
        public override void Foo()
        {
            base.Foo();
            Console.WriteLine("B.Foo()");
        }
    }
}
